package com.fengdi.everyday.easy;


/**
 * @Description 1716. 计算力扣银行的钱
 * @Date 09:31
 */
public class TotalMoney {
    public int totalMoney(int n) {
        int fullWeek = n / 7; // 总的周数
        int remainDay = n % 7; // 剩余的天数

        int ans = 0;
        for(int i = 1; i <= fullWeek; i++) { // 计算满周的钱数
            ans += 7 * i + 21;
        }

        // 计算剩余天数的钱数
        ans += remainDay * (fullWeek + 1) + (remainDay * (remainDay - 1)) / 2;
        return ans;
    }
}
